import java.io.Serializable;

enum QueryCode {

    PutRequest, GetRequest, PutResponse, GetResponse;
}

enum Status {

    Worked, InvalidRangeError, WriteError;
}

public class Query {

    private final QueryCode code;

    public Query(QueryCode c) {
        this.code = c;
    }
}

class PutRequest extends Query implements Serializable {

    Star star;

    public PutRequest(Star s) {
        super(QueryCode.PutRequest);
        star = s;
    }
}

class GetRequest extends Query implements Serializable {

    String type;
    String compare;
    double value;

    public GetRequest(String type, String compare, double value) {
        super(QueryCode.GetRequest);
        this.type = type;
        this.compare = compare;
        this.value = value;
    }
}

class PutResponse extends Query implements Serializable {

    Status c;

    public PutResponse(Status c) {
        super(QueryCode.PutResponse);
        this.c = c;
    }
}

class GetResponse extends Query implements Serializable {

    String response;

    public GetResponse(String response) {
        super(QueryCode.GetResponse);
        this.response = response;
    }
}